package com.xxxx.yebserver.config.security;

import com.xxxx.yebserver.common.R;
import com.xxxx.yebserver.common.utils.ResponseUtils;
import org.springframework.security.core.AuthenticationException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 登录错误返回
 */
public class RestAuthorizationEntryPoint implements org.springframework.security.web.AuthenticationEntryPoint {
    @Override
    public void commence(HttpServletRequest req, HttpServletResponse resp, AuthenticationException e) throws IOException, ServletException {
        ResponseUtils.out(resp, R.error(401,"尚未登录，请登录"));
    }
}
